package xdu.lz.aop.annotaion;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @date 2020/5/3 12:45
 */
//切面
@Aspect
@Component
public class MyAspect {
	//定义切入点 ,语法：execution(修饰符  返回值  包.类.方法名(参数) throws异常)
	@Pointcut("execution(* xdu.lz.aop.annotaion.Car.*(..))")
	public void aspectCar(){

	}

	@Pointcut("execution(* xdu.lz.aop.annotaion.Bike.*(..))")
	public void aspectBike(){

	}

	@Before("aspectCar()")
	public void testCar(){
		System.out.println("car before---");
	}

	@Before("aspectBike()")
	public void testBike(){
		System.out.println("bike after---");
	}
}
